package edu.tamu.cse.teamproject1;

import java.util.List;
import java.util.Stack;

import edu.tamu.cse.teamproject1.Database.Exceptions.InvalidColumnException;
import edu.tamu.cse.teamproject1.Database.Exceptions.NullReferenceException;
import edu.tamu.cse.teamproject1.Database.Exceptions.SqlException;
import edu.tamu.cse.teamproject1.Database.Interfaces.ITuple;
import edu.tamu.cse.teamproject1.Database.Parser.QueryFilter;

public class QueryFilterExtension extends QueryFilter {
	/**
	 * Calls the protected method parseFilterQuery()
	 * 
	 * @param query
	 * @return Results from parseFilterQuery
	 */
	public Stack<String> callParseFilterQuery(String query) {
		return this.parseFilterQuery(query);
	}
	
	/**
	 * Calls the protected trimSpaces method
	 * 
	 * @param query
	 * @return Trimmed query
	 */
	public String callTrimSpaces(String query) {
		return this.trimSpaces(query);
	}
	
	/**
	 * Calls the protected checkOperator method
	 * 
	 * @param operator Operator to check
	 * @return Result from checkOperator
	 */
	public boolean callCheckOperator(String operator) {
		return this.checkOperator(operator);
	}
	
	/**
	 * Calls the protected splitKeyValuePair method
	 * 
	 * @param kvpair Key-Value pair to split into array
	 * @return The result from splitOperationQuery
	 */
	public String[] callSplitKeyValuePair(String kvpair) {
		return this.splitKeyValuePair(kvpair);
	}
	
	/**
	 * Calls the protected method 
	 * 
	 * @param searchRows
	 * @param columnName
	 * @param columnValue
	 * @param comparator
	 * @return The result from getMatchingRows
	 * @throws NullReferenceException, InvalidColumnException through the method
	 */
	public List<ITuple> callGetMatchingRows(List<ITuple> searchRows, String columnName,
			String columnValue, String comparator) 
			throws NullReferenceException, InvalidColumnException, SqlException {
		return this.getMatchingRows(searchRows, columnName, columnValue, comparator);
	}
	
	/**
	 * Calls the protected checkColumnNameExists method
	 * 
	 * @param columnName
	 * @return Result from checkColumnNameExists
	 * @throws NullReferenceException through the method
	 */
	public boolean callCheckColumnNameExists(String columnName) throws NullReferenceException {
		return this.checkColumnNameExists(columnName);
	}
	
	/**
	 * Calls the protected performQuery method
	 * 
	 * @param queryStack
	 * @return Result from perform query
	 * @throws SqlException through the method
	 */
	public List<ITuple> callPerformQuery(Stack<String> queryStack) throws SqlException {
		return this.performQuery(queryStack);
	}
}
